<?php
include dirname(dirname(__FILE__)).'/admin-verify.php';
include dirname(dirname(__FILE__)).'/user-manage/functions.php';
include_once dirname(dirname(dirname(__FILE__))).'/include/host-base.php';

$id = addslashes($_GET['id']);
$row = getUserById($id);
$arr = json_decode($row['available_time'],true);
$check_icon = '<span class="glyphicon glyphicon-ok"></span>';
?>

<!DOCTYPE html>
<html>
	<head>
		<?php include dirname(dirname(dirname(__FILE__))).'/include/common-header.php'; ?>

		<script type="text/javascript">
		$(document).ready(function() {
			//$("input").attr("maxlength","16");
			$("#trun-back-btn").click(function() {
				window.location=<?php echo '"'.getHost().'/admin/user-manage/index.php";'; 
				?>
				return false;
			});
		});
		</script>

		<link rel="stylesheet" type="text/css" href="../css/style.css">
	</head>
	<body>
		<div class="col-md-12">
			<div>
				<h3> <?php echo $row['username']; ?> 的个人信息</h3>
			</div>
			<form class="form-horizontal" role="form" >
			  <div class="form-group">
			    <label for="password" class="col-sm-2 control-label">用户权限</label>
			    <div class="col-sm-10">
			      <p class="form-control-static"><?php echo $row['user_role']; ?></p>
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="student_id" class="col-sm-2 control-label">学号</label>
			    <div class="col-sm-10">
			      <p class="form-control-static"><?php echo $row['student_id']; ?></p>
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="department" class="col-sm-2 control-label">学院</label>
			    <div class="col-sm-10">
			     	<p class="form-control-static"><?php echo $row['department']; ?></p>
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="grade" class="col-sm-2 control-label">年级</label>
			    <div class="col-sm-10">
			      <p class="form-control-static"><?php echo $row['grade']; ?></p>
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="user_real_name" class="col-sm-2 control-label">姓名</label>
			    <div class="col-sm-10">
			      <p class="form-control-static"><?php echo $row['user_real_name']; ?></p>
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="sex" class="col-sm-2 control-label">性别</label>
			    <div class="col-sm-10">
			      <p class="form-control-static"><?php echo $row['sex']; ?></p>
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="phone" class="col-sm-2 control-label">联系方式</label>
			    <div class="col-sm-10">
			      <p class="form-control-static"><?php echo $row['phone']; ?></p>
			    </div>
			  </div>

			  <div class="form-group">
			    <label for="#" class="col-sm-2 control-label">可值班时间</label>
			    <div class="col-sm-10">
			        <table class="table table-striped table-bordered table-hover table-condensed" id="default-table">
					  <tr>
					  	<th>#</th>
					  	<th>星期一</th>
					  	<th>星期二</th>
					  	<th>星期三</th>
					  	<th>星期四</th>
					  	<th>星期五</th>
					  	<th>星期六</th>
					  	<th>星期天</th>
					  </tr>
					  <?php 
					  $time = array();
					  $time['a']='7:30~10:00';$time['b']='10:00~12:30';
					  $time['c']='12:30~14:30';$time['d']='14:30~16:00';
					  $time['e']='16:00~18:30';$time['f']='18:30~22:30';
					  foreach(range('a', 'f') as $item) {
					  	echo '<tr>';
					  	echo '<td>'.$time[$item].'</td>';
					  	for($i=1;$i<=7;$i++) {
					  		echo '<td>';
					  		if($arr[$i][$item]=='1')echo $check_icon;
					  		echo '</td>';
					  	}
					  	echo '</tr>';
					  }
					  ?>
					 
					</table>
			    </div>
			  </div>
			  <div class="form-group">
			    <div class="col-sm-offset-2 col-sm-10">
			      <button  class="btn btn-default" id="trun-back-btn">返回</button>
			    </div>
			</form>			
		</div>
	</body>
</html>